package com.vincent.dao;

import com.vincent.model.MenuPermission;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by vincent on 15-1-3.
 */
@Repository("menuPermissionDao")
public class MenuPermissionDao {
    @Resource
    private MenuPermissionMapper menuPermissionMapper;

    public void deleteByPermissionIds(Integer []ids){
        menuPermissionMapper.deleteByPerIds(ids);
    }

    public void deleteByMenuIds(Integer []ids){
        menuPermissionMapper.deleteByMenuIds(ids);
    }

    public List<Integer> getPerIdsByMenuId(Integer id){
        return menuPermissionMapper.getPerIds(id);
    }

    public void saveMenuPermissions(Integer menuId,Integer []perIds){
        menuPermissionMapper.insertMenuPers(menuId,perIds);
    }

    public List<MenuPermission> selectAll(){
        return menuPermissionMapper.selectAll();
    }
}
